package com.wltt.healing.healingusercommon.utils;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * @Author: wltt
 * @Date: 2021/9/8 15:26：
 * @Version: 1.0
 * @Description: TODO
 */
public abstract class Md5Util {

    /**
     * 最简单的md5运算
     *
     * @param str 原字符串
     * @return 字符编码
     */
    public static String getMD5String(String str) throws NoSuchAlgorithmException {
        MessageDigest messageDigest = MessageDigest.getInstance("MD5");
        messageDigest.update(str.getBytes());
        return new BigInteger(1, messageDigest.digest()).toString(16);
    }


    public static void main(String[] args) throws NoSuchAlgorithmException {
        System.out.println(getMD5String(""));
    }
}
